package com.sitech.util.password;

import org.apache.commons.codec.binary.Base64;

public class BASE64Encoder implements PasswordEncoder
{
	/**
	 * (non-Javadoc)
	 * @see com.sitech.util.password.PasswordEncoder#decode(java.lang.String)
	 */
	public String decode(String codeSting)
	{
		Base64 base64 = new Base64();
		byte[] bytes = base64.decode(codeSting);
		return new String(bytes);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.util.password.PasswordEncoder#encode(java.lang.String)
	 */
	public String encode(String uncodeString)
	{
		Base64 base64 = new Base64();
		String codeString = base64.encodeToString(uncodeString.getBytes());
		return new String(codeString);
	}
}
